<?php

if( isset( $_POST['hostname'] ) 
&& isset( $_POST['username'] ) && isset( $_POST['password'] ) && isset( $_POST['db'] ) )
{
	file_put_contents( App::$Current->Path . '/Config.php', '<?php
	
	R::setup(\'mysql:host=' . $_POST['hostname'] . ';dbname=' . $_POST['db'] . '\',\'' . $_POST['username'] . '\', \'' . $_POST['password'] . '\');
	
	?>' );
	
	?>
	<h1>Installation finished!</h1>
	<?php
}
else
{
	?>
	<form method="post">
	<h3>MySQL</h3>
		sqlhostname<input type="text" name="hostname" /><br />
		username<input type="text" name="username" /><br />
		password<input type="text" name="password" /><br />
		database<input type="text" name="db" /><br />
		<input type="submit" />
	</form>
	<?php
}

?>